home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr25
/
gnuplsrc.zip
/
GNUSHELL.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-21
|
6KB
|
212 lines
#ifdef INCRCSDATA
static char RCSid[]="$Id: gnushell.c,v 1.2 1992/07/26 12:37:10 fearick Exp fearick $" ;
#endif
/****************************************************************************
PROGRAM: gnushell
a shell for gnuplot to allow plotting on pm with minimum hassle
MODULE: gnushell.c
This file contains the startup procedures for gnushell
Copyright (c) 1992, Roger Fearick.
All rights reserved
THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT WARRANTIES OF ANY KIND.
Permission is hereby granted for personal, non-commercial use of this
software.You are granted the right to use, modify, and redistribute
it for for non-commercial purposes, provided that all copyright
notices remain intact and all changes are clearly documented.
THE AUTHOR MAKES NO WARRANTY OF ANY KIND WITH RESPECT TO THIS PRODUCT
AND EXPLICITLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY
OR FITNESS FOR ANY PARTICULAR PURPOSE.
****************************************************************************/
/* Update Log
**
* $Log: gnushell.c,v $
* Revision 1.2 1992/07/26 12:37:10 fearick
* Initial 32-bit version
*
* Revision 1.1 1992/07/25 15:43:33 fearick
* Initial revision
*
*
*/
#define INCL_PM
#define INCL_WIN
#define INCL_DOSMEMMGR
#define INCL_DOSPROCESS
#define INCL_DOSFILEMGR
#include <os2.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "gnushell.h"
/* identification */
#define APP_NAME "GnuShell"
/*==== l o c a l d a t a ==================================================*/
/* class names for window registration */
static char szChildName [] = "Gnuchild" ;
/*==== f u n c t i o n s =====================================================*/
int main( void ) ;
static HWND InitHelp( HAB, HWND ) ;
MRESULT EXPENTRY NewFrameWndProc(HWND, ULONG, MPARAM, MPARAM) ;
MRESULT EXPENTRY About(HWND, ULONG, MPARAM, MPARAM);
/*==== c o d e ===============================================================*/
int main ( )
/*
**
** Standard PM initialisation:
** -- set up message processing loop
** -- register all window classes
** -- start up main window
** -- subclass main window for help and dde message trapping to frame window
** -- init help system
** -- check command line and open any filename found there
**
*/
{
static ULONG flFrameFlags = (FCF_ACCELTABLE|FCF_STANDARD);//&(~FCF_TASKLIST) ;
static ULONG flClientFlags = WS_VISIBLE ;
HMQ hmq ;
QMSG qmsg ;
PFNWP pfnOldFrameWndProc ;
HWND hwndHelp ;
hab = WinInitialize( 0 ) ;
hmq = WinCreateMsgQueue( hab, 50 ) ;
// register window and child window classes
if( ! WinRegisterClass( hab, /* Exit if can't register */
APP_NAME,
(PFNWP)DisplayClientWndProc,
CS_SIZEREDRAW,
0 )
) return 0L ;
// create main window
hwndFrame = WinCreateStdWindow (
HWND_DESKTOP,
WS_VISIBLE,
&flFrameFlags,
APP_NAME,
NULL,
flClientFlags,
0L,
1,
&hApp) ;
if ( ! hwndFrame ) return NULL ;
// subclass window for help & DDE trapping
pfnOldFrameWndProc = WinSubclassWindow( hwndFrame, (PFNWP)NewFrameWndProc ) ;
WinSetWindowULong( hwndFrame, QWL_USER, (ULONG) pfnOldFrameWndProc ) ;
// init the help manager
hwndHelp = InitHelp( hab, hwndFrame ) ;
// set window title and make it active
WinSetWindowText( hwndFrame, APP_NAME ) ;
WinSetActiveWindow( HWND_DESKTOP, hwndFrame ) ;
// process window messages
while (WinGetMsg (hab, &qmsg, NULL, 0, 0))
WinDispatchMsg (hab, &qmsg) ;
// shut down
WinDestroyHelpInstance( hwndHelp ) ;
WinDestroyWindow (hwndFrame) ;
WinDestroyMsgQueue (hmq) ;
WinTerminate (hab) ;
return 0 ;
}
static HWND InitHelp( HAB hab, HWND hwnd )
/*
** initialise the help system
*/
{
static HELPINIT helpinit = { sizeof(HELPINIT),
0L,
NULL,
(PHELPTABLE)MAKELONG(1, 0xFFFF),
0L,
0L,
0,
0,
"Gnushell Help",
CMIC_HIDE_PANEL_ID,
"gnushell.hlp" } ;
HWND hwndHelp ;
hwndHelp = WinCreateHelpInstance( hab, &helpinit ) ;
WinAssociateHelpInstance( hwndHelp, hwnd ) ;
return hwndHelp ;
}
MRESULT EXPENTRY NewFrameWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
/*
** Subclasses top-level frame window to trap help & dde messages
*/
{
PFNWP pfnOldFrameWndProc ;
pfnOldFrameWndProc = (PFNWP) WinQueryWindowULong( hwnd, QWL_USER ) ;
switch( msg ) {
default:
break ;
case HM_QUERY_KEYS_HELP:
return (MRESULT) IDH_KEYS ;
}
return (*pfnOldFrameWndProc)(hwnd, msg, mp1, mp2) ;
}
MRESULT EXPENTRY About( HWND hDlg, ULONG message, MPARAM mp1, MPARAM mp2)
/*
** 'About' box dialog function -- basically generic
*/
{
switch (message) {
case WM_COMMAND:
if (SHORT1FROMMP(mp1) == DID_OK) {
WinDismissDlg( hDlg, DID_OK );
return 0L;
}
break;
}
return WinDefDlgProc( hDlg, message, mp1, mp2 ) ;
}